package com.grass.p019lv.view.svip;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.InventionBean;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.listener.ItemClickListener;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.invention.OnInventionType;
import com.androidx.p013lv.invention.adapter.AdapterSvipVertical;

/* renamed from: com.grass.lv.view.svip.SvipOneView */
public class SvipOneView {
    AdapterSvipVertical adapter;
    LinearLayout btn_more;
    private boolean clickLimit = true;
    Context context;
    String domain;
    Fragment fragment;
    InventionBean inventionBean;
    ImageView iv_cover;
    private long lastClickTime;
    OnInventionType onInventionType;
    int position;
    RecyclerView recycler;
    TextView tv_title;

    public SvipOneView(View view, Fragment fragment2, String str, OnInventionType onInventionType2) {
        this.context = view.getContext();
        this.onInventionType = onInventionType2;
        this.domain = str;
        this.fragment = fragment2;
        this.recycler = (RecyclerView) view.findViewById(R.id.recycler);
        this.tv_title = (TextView) view.findViewById(R.id.tv_title);
        this.iv_cover = (ImageView) view.findViewById(R.id.iv_cover);
        this.btn_more = (LinearLayout) view.findViewById(R.id.btn_more);
        ViewGroup.LayoutParams layoutParams = this.iv_cover.getLayoutParams();
        layoutParams.height = (int) ((double) ((UiUtils.getWindowWidth() * 230) / 429));
        this.iv_cover.setLayoutParams(layoutParams);
    }

    public void setView(InventionBean inventionBean2, int i) {
        this.inventionBean = inventionBean2;
        this.position = i;
        this.tv_title.setText(inventionBean2.getStationName());
        this.btn_more.setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.view.svip.SvipOneView.View$OnClickListenerC32311 */

            public void onClick(View view) {
                SvipOneView.this.onInventionType.onClick(SvipOneView.this.inventionBean, SvipOneView.this.position, view.getId());
            }
        });
        if (this.inventionBean.getVideoList().size() > 0) {
            setRecycler(this.inventionBean);
        }
    }

    /* access modifiers changed from: package-private */
    public void setRecycler(InventionBean inventionBean2) {
        if (this.adapter == null) {
            this.adapter = new AdapterSvipVertical(this.fragment, this.domain);
            this.recycler.setLayoutManager(new LinearLayoutManager(this.context, 0, false));
            this.recycler.setAdapter(this.adapter);
            this.adapter.setItemListener(new ItemClickListener() {
                /* class com.grass.p019lv.view.svip.SvipOneView.C32322 */

                @Override // com.androidx.p013lv.base.listener.ItemClickListener
                public void onItemClick(View view, int i) {
                    if (!SvipOneView.this.isOnClick()) {
                        ARouter.getInstance().build(Constance.VIDEO_PLAY_ACTIVITY).withSerializable(Key.VIDEO_ID, Integer.valueOf(((VideoBean) SvipOneView.this.adapter.getDataInPosition(i)).getVideoId())).navigation();
                    }
                }
            });
        }
        this.adapter.setData(inventionBean2.getVideoList());
        if (inventionBean2.getCoverImg() == null || TextUtils.isEmpty(inventionBean2.getCoverImg())) {
            GlideUtils.loadCropRadiusDefault(0, this.iv_cover);
        } else {
            GlideUtils.loadCropRadiusWh2(this.domain + inventionBean2.getCoverImg(), 4, this.iv_cover, Constance.BIG_PIC);
        }
        this.iv_cover.setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.view.svip.SvipOneView.View$OnClickListenerC32333 */

            public void onClick(View view) {
                if (!SvipOneView.this.isOnClick()) {
                    ARouter.getInstance().build(Constance.SVIP_GOLD_ACTIVITY).withString(Key.TXT, SvipOneView.this.inventionBean.getStationName()).withInt("type", SvipOneView.this.inventionBean.getStationId()).navigation();
                }
            }
        });
    }

    /* access modifiers changed from: protected */
    public boolean isOnClick() {
        long currentTimeMillis = System.currentTimeMillis();
        long j = currentTimeMillis - this.lastClickTime;
        if (j > 1000) {
            this.lastClickTime = currentTimeMillis;
        }
        return !this.clickLimit ? j < 0 : j <= 1000;
    }
}
